package com.sedric.utils;

import java.io.File;

import org.apache.commons.lang.StringUtils;

public class FileUtils {

    public static void delete(String fileName) {

        if (StringUtils.isBlank(fileName)) {
            return;
        }

        File file = new File(fileName);
        delete(file);
    }

    public static void delete(File file) {
        if (!file.exists()) {
            return;
        }
        if (file.isDirectory()) {
            File[] fileList = file.listFiles();
            for (File f : fileList) {
                delete(f);
            }
            file.delete();
        }
        file.delete();
    }
    
    public static void main(String args[]){
        String file = "d:/files";
        delete(file);
    }
}
